public class Particles
extends com.fs.starfarer.api.combat.BaseEveryFrameCombatPlugin
implements com.fs.starfarer.api.combat.CombatLayeredRenderingPlugin
initialize(org.lwjgl.util.vector.Vector2f, int, int, int) or a custom emitter by extending IEmitter,
set the emitter's properties with methods in Emitter,
and generate particles using an emitter with burst(particleengine.IEmitter, int) or stream(particleengine.IEmitter, int, float, float).| Modifier and Type | Class and Description |
|---|---|
static interface |
Particles.StreamAction<T extends IEmitter>
Action that can be performed before each generation in a
stream(IEmitter, int, float, float, StreamAction) call. |
| Constructor and Description |
|---|
Particles() |
| Modifier and Type | Method and Description |
|---|---|
void |
advance(float amount) |
void |
advance(float amount,
java.util.List<com.fs.starfarer.api.input.InputEventAPI> events)
This is done automatically and should not be manually called.
|
static void |
anchorEmitter(IEmitter emitter,
com.fs.starfarer.api.combat.CombatEntityAPI entity)
Anchors an
emitter to a CombatEntityAPI. |
static boolean |
burst(IEmitter emitter,
int count)
Generates an instantaneous burst of particles.
|
void |
cleanup() |
static Emitter |
createCopy(Emitter copy)
Same as
createCopy(Emitter, SpriteAPI, int, int, int), but also copies copy's
sprite and blending settings. |
static Emitter |
createCopy(Emitter copy,
com.fs.starfarer.api.graphics.SpriteAPI sprite)
Same as
createCopy(Emitter, SpriteAPI, int, int, int), but also copies copy's
blending settings. |
static Emitter |
createCopy(Emitter copy,
com.fs.starfarer.api.graphics.SpriteAPI sprite,
int sfactor,
int dfactor,
int blendMode)
Initializes an
Emitter with the given sprite and blend mode settings, and then copies
all of copy's properties to it. |
java.util.EnumSet<com.fs.starfarer.api.combat.CombatEngineLayers> |
getActiveLayers() |
float |
getRenderRadius() |
void |
init(com.fs.starfarer.api.combat.CombatEngineAPI engine)
This is done automatically and should not be manually called.
|
void |
init(com.fs.starfarer.api.combat.CombatEntityAPI entity) |
static Emitter |
initialize(org.lwjgl.util.vector.Vector2f location)
Same as
initialize(Vector2f, SpriteAPI, int, int, int), but uses the default
additive blending and a default particle sprite. |
static Emitter |
initialize(org.lwjgl.util.vector.Vector2f location,
int sfactor,
int dfactor,
int blendMode)
Same as
initialize(Vector2f, SpriteAPI, int, int, int), but uses a default particle sprite instead
of sampling a texture. |
static Emitter |
initialize(org.lwjgl.util.vector.Vector2f location,
com.fs.starfarer.api.graphics.SpriteAPI sprite)
Same as
initialize(Vector2f, SpriteAPI, int, int, int), but uses
additive blending by default. |
static Emitter |
initialize(org.lwjgl.util.vector.Vector2f location,
com.fs.starfarer.api.graphics.SpriteAPI sprite,
int sfactor,
int dfactor,
int blendMode)
Initialize an
Emitter. |
static Emitter |
initialize(org.lwjgl.util.vector.Vector2f location,
java.lang.String spriteLoc)
Uses default additive blending.
|
static Emitter |
initialize(org.lwjgl.util.vector.Vector2f location,
java.lang.String spriteLoc,
int sfactor,
int dfactor,
int blendMode)
Takes the sprite location instead of a SpriteAPI object.
|
boolean |
isExpired() |
void |
render(com.fs.starfarer.api.combat.CombatEngineLayers layer,
com.fs.starfarer.api.combat.ViewportAPI viewport) |
static void |
stream(IEmitter emitter,
int particlesPerBurst,
float particlesPerSecond,
float duration)
Generates a continuous stream of particles.
|
static <T extends IEmitter> |
stream(T emitter,
int particlesPerBurst,
float particlesPerSecond,
float maxDuration,
Particles.StreamAction<T> doBeforeGenerating)
Generates a continuous stream of particles.
|
static <T extends IEmitter> |
stream(T emitter,
int particlesPerBurst,
float particlesPerSecond,
float maxDuration,
Particles.StreamAction<T> doBeforeGenerating,
Particles.StreamAction<T> doWhenFinished)
Generates a continuous stream of particles.
|
public void init(com.fs.starfarer.api.combat.CombatEntityAPI entity)
init in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic void cleanup()
cleanup in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic boolean isExpired()
isExpired in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic java.util.EnumSet<com.fs.starfarer.api.combat.CombatEngineLayers> getActiveLayers()
getActiveLayers in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic float getRenderRadius()
getRenderRadius in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic void advance(float amount)
advance in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic void render(com.fs.starfarer.api.combat.CombatEngineLayers layer,
com.fs.starfarer.api.combat.ViewportAPI viewport)
render in interface com.fs.starfarer.api.combat.CombatLayeredRenderingPluginpublic void init(com.fs.starfarer.api.combat.CombatEngineAPI engine)
init in interface com.fs.starfarer.api.combat.CombatEnginePlugininit in class com.fs.starfarer.api.combat.BaseEveryFrameCombatPluginpublic void advance(float amount,
java.util.List<com.fs.starfarer.api.input.InputEventAPI> events)
advance in interface com.fs.starfarer.api.combat.EveryFrameCombatPluginadvance in class com.fs.starfarer.api.combat.BaseEveryFrameCombatPluginpublic static void anchorEmitter(IEmitter emitter, com.fs.starfarer.api.combat.CombatEntityAPI entity)
emitter to a CombatEntityAPI. Sets the emitter's location to the entity's
location every frame until the entity is no longer in play. Will also kill any particle streams using an anchored
emitter if that emitter's anchor entity is no longer in play. IEmitter.enableDynamicAnchoring().emitter - Emitter to anchorentity - The combat entity to anchor topublic static Emitter initialize(org.lwjgl.util.vector.Vector2f location, int sfactor, int dfactor, int blendMode)
initialize(Vector2f, SpriteAPI, int, int, int), but uses a default particle sprite instead
of sampling a texture.public static Emitter initialize(org.lwjgl.util.vector.Vector2f location)
initialize(Vector2f, SpriteAPI, int, int, int), but uses the default
additive blending and a default particle sprite.public static Emitter initialize(org.lwjgl.util.vector.Vector2f location, com.fs.starfarer.api.graphics.SpriteAPI sprite, int sfactor, int dfactor, int blendMode)
Emitter. The Emitter's location will be set to location, specified
in world coordinates. The Emitter's attributes will be initialized to
default values and should be set in subsequent calls. To generate particles,
use burst(particleengine.IEmitter, int) or stream(particleengine.IEmitter, int, float, float). sprite's texture into memory. Textures not in data/config/settings.json
are not automatically loaded. Use initialize(Vector2f, String, int, int, int) to load
loose textures into memory.sprite - The texture that the particles should sample when rendered. Must already have
been loaded into memory.sfactor - Source blend factor.dfactor - Destination blend factor.blendMode - Blending operation.Emitterpublic static Emitter createCopy(Emitter copy, com.fs.starfarer.api.graphics.SpriteAPI sprite, int sfactor, int dfactor, int blendMode)
Emitter with the given sprite and blend mode settings, and then copies
all of copy's properties to it. Changes in properties of the resulting emitter are not reflected in
the original copy, nor vice versa.public static Emitter createCopy(Emitter copy, com.fs.starfarer.api.graphics.SpriteAPI sprite)
createCopy(Emitter, SpriteAPI, int, int, int), but also copies copy's
blending settings.copy - Emitter whose properties to copysprite - Texture to use for the new emittercopypublic static Emitter createCopy(Emitter copy)
createCopy(Emitter, SpriteAPI, int, int, int), but also copies copy's
sprite and blending settings.copy - Emitter whose properties to copycopypublic static Emitter initialize(org.lwjgl.util.vector.Vector2f location, com.fs.starfarer.api.graphics.SpriteAPI sprite)
initialize(Vector2f, SpriteAPI, int, int, int), but uses
additive blending by default.public static Emitter initialize(org.lwjgl.util.vector.Vector2f location, java.lang.String spriteLoc, int sfactor, int dfactor, int blendMode)
public static Emitter initialize(org.lwjgl.util.vector.Vector2f location, java.lang.String spriteLoc)
public static boolean burst(IEmitter emitter, int count)
emitter - IEmitter to use.count - Number of particles to generate.false, this generally means that
the combat engine is null.public static void stream(IEmitter emitter, int particlesPerBurst, float particlesPerSecond, float duration)
emitter - IEmitter to use.particlesPerBurst - Number of particles that should be generated at once.particlesPerSecond - Total number of particles generated per second.duration - Amount of time this particle stream should last. If negative, the stream will never expire.public static <T extends IEmitter> void stream(T emitter, int particlesPerBurst, float particlesPerSecond, float maxDuration, @Nullable Particles.StreamAction<T> doBeforeGenerating)
emitter - IEmitter to use.particlesPerBurst - Number of particles that should be generated at once.particlesPerSecond - Total number of particles generated per second.maxDuration - Maximum amount of time this particle stream should last. If negative, the stream
will not naturally expire.doBeforeGenerating - Custom function that's called immediately before each particle generation sequence in this stream.
Returning false will end the stream.public static <T extends IEmitter> void stream(T emitter, int particlesPerBurst, float particlesPerSecond, float maxDuration, @Nullable Particles.StreamAction<T> doBeforeGenerating, @Nullable Particles.StreamAction<T> doWhenFinished)
emitter - IEmitter to use.particlesPerBurst - Number of particles that should be generated at once.particlesPerSecond - Total number of particles generated per second.maxDuration - Maximum amount of time this particle stream should last. If negative, the stream
will not naturally expire.doBeforeGenerating - Custom function that's called immediately before each particle generation sequence in this stream.
Returning false will end the stream.doWhenFinished - Custom function that's called when the stream expires, which can occur either naturally, if
doBeforeGenerating returns false, or if the stream's emitter's anchor point is removed from play.
The return value is not used.